System, Global, and System Global variables are valid in any block in a model.
• System variables give you information about the state of the simulation. These variables are declared by Extend and can be viewed or modified by any block. You can read or write to these variables, but you should be very careful when writing to any of them.
• Global variables are useful for passing information between your blocks.
• System global variables begin with "Sys", are used in the Discrete Event library, and should only be used in the same context as they are used in that library. You may use the System Global variables to create your own discrete event blocks.
The System Variables are (in alphabetical order):
• AnimationOn
Tells the state of the Show Animation command from the Run menu. If it is checked, AnimationOn is 1, otherwise it is 0.
• CurrentSim
Current simulation number. Its value starts at 0 and increments each step up to NumSims-1. It only has a non-zero value if you set the "Number of runs" option in the Simulation Setup dialog to a value greater than 1. Use this variable in batch or Monte-Carlo simulations to select new input data sets and store data from multiple simulations into an array.
• CurrentStep
The integer current step number during a simulation. In a continuous simulation, its value starts at 0 and increments each step up to and including NumSteps-1. In a discrete event simulation, the value starts at 0 and increments with each event. It is useful as an array subscript.
• CurrentSense
Used by sensitivity analysis to change parameter values. It will have the same value as CurrentSim unless the user changes it to alter the mode of sensitivity analysis.
• CurrentTime
The current simulation time during a simulation. In a continuous simulation, its value starts at StartTime and increments at DeltaTime for each step in the simulation. In a discrete event simulation, the Executive block in the Discrete Event library changes the CurrentTime system variable only when processing an event.
• DeltaTime
The time increment per step, as initialized in the Simulation Setup dialog. It has no meaning in a discrete event simulation.
• EndTime
The ending time of a simulation, set in the Simulation Setup dialog.
• MovieOn
Tells the state of the Show Movies command from the Run menu. If it is checked, MovieOn is 1, otherwise it is 0.
• NumSims
Number of times the simulation will be repeated. This variable can be used in the script to determine the total number of simulations run, as entered in the Simulation Setup dialog.
• NumSteps
The total number of steps that will be executed during a continuous simulation. NumSteps is the number of steps entered in the Simulation Setup dialog. It has no meaning in a discrete event simulation.
• RandomSeed
Sequence number used to initialize the random numbers generator; it is set in the Simulation Setup dialog. When debugging a simulation, it is sometimes necessary to force the random number generator to produce a repeatable sequence of pseudo-random numbers.
• SimDelay
Simulation order. 0 is Left to right, 2 is Flow order.
• SimMode
This variable can be used in the script to determine whether the user chose the Autostep Fast, Autostep Slow, or Manual simulation mode in the Simulation dialog box. It equals 0 for Manual, 1 for Autostep Fast, or 2 for Autostep Slow, as specified in the Simulation Setup dialog.
• StartTime
The starting time of a simulation at step zero, set in the Simulation Setup dialog.
The Global Variables are (in alphabetical order):
• Global0...Global19 // real
• GlobalInt0...GlobalInt9 // integer
• GlobalStr0...GlobalStr9 // string
The System Global Variables are (in alphabetical order):